<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
 		<p>请输入一个数：<input type="text" id="num">
 		<button id="haha">计算阶乘</button>
 		</p>
 		<p>结果是：<span id="Result"></span></p>
 		<script type="text/javascript">
 		document.getElementById("haha").onclick=function(){
  			var num=document.getElementById("num").value;
    		if(num>=0){
    			var Result=1;
    			for(var i=1;i<=num;i++){
     		 		Result*=i;
     		 	}
   		 	}
   		 document.getElementById("Result").innerHTML=Result;
 		}
 		</script>
	</body>
</html>
